/**
 * 处理界面逻辑
 */
var d1 = require("devinceone");
var dojs = require("dojs");
var dynamicButton = "dynamicButton";

module.exports.initBottom = initBottom;

// -------------------------
function initBottom(pray, bestow, personal, viewShower) {

	// 给vieShower添加数据源
	viewShower.addViews(getViewShowerData());
	viewShower.showView("pray");
	// 给父布局加监听
	dojs.page.onTouch(pray.father, function() {
		pray.image.source = "source://image/home/pray_checked.png";
		pray.label.fontColor = "1296db";

		bestow.image.source = "source://image/home/bestow_unchecked.png";
		bestow.label.fontColor = "bfbfbf";

		personal.image.source = "source://image/home/personal_unchecked.png";
		personal.label.fontColor = "bfbfbf";
		
		viewShower.showView("pray");
	});

	dojs.page.onTouch(bestow.father, function() {
		pray.image.source = "source://image/home/pray_unchecked.png";
		pray.label.fontColor = "bfbfbf";

		bestow.image.source = "source://image/home/bestow_checked.png";
		bestow.label.fontColor = "1296db";

		personal.image.source = "source://image/home/personal_unchecked.png";
		personal.label.fontColor = "bfbfbf";
		
		viewShower.showView("bestow");
	});

	dojs.page.onTouch(personal.father, function() {
		pray.image.source = "source://image/home/pray_unchecked.png";
		pray.label.fontColor = "bfbfbf";

		bestow.image.source = "source://image/home/bestow_unchecked.png";
		bestow.label.fontColor = "bfbfbf";

		personal.image.source = "source://image/home/personal_checked.png";
		personal.label.fontColor = "1296db";
		
		viewShower.showView("personal");
	});
}
// viewShower子页面
function getViewShowerData() {

	return [ {
		"id" : "pray",
		"path" : "source://view/home/pray/src/pray.ui"
	}, {
		"id" : "bestow",
		"path" : "source://view/home/bestow/src/bestow.ui"
	}, {
		"id" : "personal",
		"path" : "source://view/home/personal/src/personal.ui",
	} ];
}
